/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * SocialApplication.java
 *
 * Created on 22.Ara.2011, 23:32:13
 */
package oopdesignpatternsproject;

import entityclasses.SocialApp;
import factories.ObjectFactory;

import entityclasses.Person;

import java.awt.Component;
import javax.swing.JLabel;

import entityclasses.PlainTextShare;
import entityclasses.Related;
import entityclasses.Session;

import entityclasses.Share;



/**
 *
 * @author umutcan
 */
public class SocialApplication extends javax.swing.JFrame {

    SocialApp program = SocialApp.instance();
    Person p1;
    Person p2;
    Person p3;
    /** Creates new form SocialApplication */
    public SocialApplication() {
        initComponents();
        this.setLocationRelativeTo(null);
        lblOturumAc.setText("Oturum Aç");
        setup();
        
    }

    public void setup()
    {
        p1 = new Person();
        p1.setFirstName("Mustafa");
        p1.setLastName("Topaloğlu");
        p1.setId(1);
        p1.register(program);
        p1.getProfile().setProfileName("Uzaylı");
        
        Session.currentUser = p1;
        
        p2 = (Person) ObjectFactory.create(Person.class);
        p2.setFirstName("Ahmet Mete");
        p2.setLastName("Işıkara");
        p2.setId(2);
        p2.register(program);
        p2.getProfile().setProfileName("Deprem Dede");
        
        
        p3 = (Person) ObjectFactory.create(Person.class);
        p3.setFirstName("Beril");
        p3.setLastName("Kedican");
        p3.setId(3);
        p3.register(program);
        p3.getProfile().setProfileName("Little Pidgeon");
        
        
        
        Related r1 = new Related();
        r1.setRelatedness("Kuzen");
        r1.setaPerson(p3);
        r1.addRelated(p1);
        
        //p2.addAsFriend(p1);
        
//        Group g1 = (Group)ObjectFactory.create(Group.class);
//        g1.setName("Hebele");        
//        Group g1s1 = (Group)ObjectFactory.create(Group.class);
//        g1s1.setName("Hebelesub");
//        
//        
//        Group g2 = (Group)ObjectFactory.create(Group.class);
//        g2.setName("Hebele2");
        
//        p1.getProfile().addGroup(g1);
//        g1.addSubGroup(g1s1);
        
        
        

//        p1.getProfile().addGroup(g2);
        
        //p1.acceptRequest(p2);
        
        program.getRelationshipTypes().add("Evli");
        program.getRelationshipTypes().add("Mutlu");
        program.getRelationshipTypes().add("Çcouklu");
        
        lblKullaniciAdi.setText(p1.getFirstName() + " " + p1.getLastName());
        lblProfilAdi.setText(p1.getProfile().getProfileName());
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel1 = new javax.swing.JLabel();
        lblKullaniciAdi = new javax.swing.JLabel();
        lblHaberKaynagi = new javax.swing.JLabel();
        lblGruplar = new javax.swing.JLabel();
        lblArkadaslar = new javax.swing.JLabel();
        lblProfilAdi = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        txtPaylas = new javax.swing.JTextField();
        btnPaylas = new javax.swing.JButton();
        pnlPaylasimlar = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        txtArama = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        lblOturumAc = new javax.swing.JLabel();
        lblProfilimiDuzenle = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("Form"); // NOI18N

        mainPanel.setName("mainPanel"); // NOI18N
        mainPanel.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentShown(java.awt.event.ComponentEvent evt) {
                mainPanelComponentShown(evt);
            }
        });

        jPanel1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
        jPanel1.setName("jPanel1"); // NOI18N

        jSeparator1.setName("jSeparator1"); // NOI18N

        jLabel1.setName("jLabel1"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance().getContext().getResourceMap(SocialApplication.class);
        lblKullaniciAdi.setFont(resourceMap.getFont("lblKullaniciAdi.font")); // NOI18N
        lblKullaniciAdi.setText(resourceMap.getString("lblKullaniciAdi.text")); // NOI18N
        lblKullaniciAdi.setName("lblKullaniciAdi"); // NOI18N

        lblHaberKaynagi.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblHaberKaynagi.setText(resourceMap.getString("lblHaberKaynagi.text")); // NOI18N
        lblHaberKaynagi.setToolTipText(resourceMap.getString("lblHaberKaynagi.toolTipText")); // NOI18N
        lblHaberKaynagi.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        lblHaberKaynagi.setName("lblHaberKaynagi"); // NOI18N
        lblHaberKaynagi.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblHaberKaynagiMouseClicked(evt);
            }
        });

        lblGruplar.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblGruplar.setText(resourceMap.getString("lblGruplar.text")); // NOI18N
        lblGruplar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        lblGruplar.setName("lblGruplar"); // NOI18N
        lblGruplar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblGruplarMouseClicked(evt);
            }
        });

        lblArkadaslar.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblArkadaslar.setText(resourceMap.getString("lblArkadaslar.text")); // NOI18N
        lblArkadaslar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        lblArkadaslar.setName("lblArkadaslar"); // NOI18N
        lblArkadaslar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblArkadaslarMouseClicked(evt);
            }
        });

        lblProfilAdi.setFont(resourceMap.getFont("lblProfilAdi.font")); // NOI18N
        lblProfilAdi.setText(resourceMap.getString("lblProfilAdi.text")); // NOI18N
        lblProfilAdi.setName("lblProfilAdi"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lblGruplar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE)
                            .addComponent(lblArkadaslar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE)
                            .addComponent(lblHaberKaynagi, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE)
                            .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE))
                        .addContainerGap())
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(lblKullaniciAdi, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)
                                .addGap(20, 20, 20))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(lblProfilAdi, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE)
                                .addContainerGap())))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblProfilAdi, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblKullaniciAdi, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblHaberKaynagi, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblArkadaslar, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblGruplar, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(535, Short.MAX_VALUE))
        );

        lblHaberKaynagi.getAccessibleContext().setAccessibleName(resourceMap.getString("jLabel4.AccessibleContext.accessibleName")); // NOI18N

        jPanel2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
        jPanel2.setName("jPanel2"); // NOI18N

        jPanel3.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
        jPanel3.setName("jPanel3"); // NOI18N

        txtPaylas.setText(resourceMap.getString("txtPaylas.text")); // NOI18N
        txtPaylas.setName("txtPaylas"); // NOI18N
        txtPaylas.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                txtPaylasFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                txtPaylasFocusLost(evt);
            }
        });
        txtPaylas.addInputMethodListener(new java.awt.event.InputMethodListener() {
            public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {
            }
            public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
                txtPaylasİnputMethodTextChanged(evt);
            }
        });

        btnPaylas.setText(resourceMap.getString("btnPaylas.text")); // NOI18N
        btnPaylas.setName("btnPaylas"); // NOI18N
        btnPaylas.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnPaylasMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(txtPaylas, javax.swing.GroupLayout.PREFERRED_SIZE, 524, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnPaylas)
                .addContainerGap(2, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtPaylas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnPaylas))
                .addContainerGap(14, Short.MAX_VALUE))
        );

        pnlPaylasimlar.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        pnlPaylasimlar.setName("pnlPaylasimlar"); // NOI18N
        pnlPaylasimlar.setPreferredSize(new java.awt.Dimension(800, 600));

        javax.swing.GroupLayout pnlPaylasimlarLayout = new javax.swing.GroupLayout(pnlPaylasimlar);
        pnlPaylasimlar.setLayout(pnlPaylasimlarLayout);
        pnlPaylasimlarLayout.setHorizontalGroup(
            pnlPaylasimlarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 607, Short.MAX_VALUE)
        );
        pnlPaylasimlarLayout.setVerticalGroup(
            pnlPaylasimlarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 553, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(pnlPaylasimlar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 609, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 609, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(pnlPaylasimlar, javax.swing.GroupLayout.PREFERRED_SIZE, 555, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel4.setName("jPanel4"); // NOI18N

        txtArama.setText(resourceMap.getString("txtArama.text")); // NOI18N
        txtArama.setName("txtArama"); // NOI18N
        txtArama.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                txtAramaFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                txtAramaFocusLost(evt);
            }
        });

        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });

        jLabel3.setName("jLabel3"); // NOI18N

        jLabel7.setName("jLabel7"); // NOI18N

        lblOturumAc.setFont(resourceMap.getFont("lblOturumAc.font")); // NOI18N
        lblOturumAc.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblOturumAc.setText(resourceMap.getString("lblOturumAc.text")); // NOI18N
        lblOturumAc.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        lblOturumAc.setName("lblOturumAc"); // NOI18N
        lblOturumAc.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblOturumAcMouseClicked(evt);
            }
        });

        lblProfilimiDuzenle.setFont(resourceMap.getFont("lblProfilimiDuzenle.font")); // NOI18N
        lblProfilimiDuzenle.setText(resourceMap.getString("lblProfilimiDuzenle.text")); // NOI18N
        lblProfilimiDuzenle.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        lblProfilimiDuzenle.setName("lblProfilimiDuzenle"); // NOI18N
        lblProfilimiDuzenle.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblProfilimiDuzenleMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(txtArama, javax.swing.GroupLayout.PREFERRED_SIZE, 319, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblOturumAc, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblProfilimiDuzenle, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel3)
                .addGap(212, 212, 212)
                .addComponent(jLabel7)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtArama, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
                            .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE)
                            .addComponent(lblOturumAc, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE)
                            .addComponent(lblProfilimiDuzenle, javax.swing.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE)))
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel7)
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 631, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(874, 874, 874))
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(mainPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 854, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void txtAramaFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtAramaFocusGained
    if(txtArama.getText().equals("Kişi Arama..."))
        txtArama.setText("");
}//GEN-LAST:event_txtAramaFocusGained

private void txtAramaFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtAramaFocusLost
    if(txtArama.getText().equals(""))
        txtArama.setText("Kişi Arama...");
}//GEN-LAST:event_txtAramaFocusLost

private void txtPaylasFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtPaylasFocusGained
    
    if(txtPaylas.getText().equals("Ne düşünüyorsun"))
        txtPaylas.setText("");
}//GEN-LAST:event_txtPaylasFocusGained

private void txtPaylasFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtPaylasFocusLost
    if(txtPaylas.getText().equals(""))
        txtPaylas.setText("Ne düşünüyorsun");
    
}//GEN-LAST:event_txtPaylasFocusLost

    private void lblHaberKaynagiMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblHaberKaynagiMouseClicked
        
    }//GEN-LAST:event_lblHaberKaynagiMouseClicked

    private void mainPanelComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_mainPanelComponentShown
        
    }//GEN-LAST:event_mainPanelComponentShown

    private void lblArkadaslarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblArkadaslarMouseClicked
        ArkadaslikIslemleri ai = new ArkadaslikIslemleri();
        
        ai.setVisible(true);
        ai.setLocationRelativeTo(null);
        
    }//GEN-LAST:event_lblArkadaslarMouseClicked

    private void lblGruplarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblGruplarMouseClicked
        GrupIslemleri gi = new GrupIslemleri();
        
        gi.setVisible(true);
        gi.setLocationRelativeTo(null);
    }//GEN-LAST:event_lblGruplarMouseClicked

    private void lblOturumAcMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblOturumAcMouseClicked
        OturumIslemleri oi = new OturumIslemleri(lblKullaniciAdi,lblProfilAdi,pnlPaylasimlar);
        oi.setVisible(true);
        oi.setLocationRelativeTo(null);
    }//GEN-LAST:event_lblOturumAcMouseClicked

private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
        AramaIslemleri ai = new AramaIslemleri(txtArama.getText());
        ai.setVisible(true);
        ai.setLocationRelativeTo(null);
}//GEN-LAST:event_jButton1MouseClicked

private void btnPaylasMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnPaylasMouseClicked
        if(txtPaylas.getText() != null)
        {
            Share newShare = new Share(txtPaylas.getText());
            newShare.shareItem(Session.currentUser);
            shareInReal(newShare);
            txtPaylas.setText(null);
        }
}//GEN-LAST:event_btnPaylasMouseClicked

public void shareInReal(Share newShare)
    {   
        JLabel paylasim = new JLabel();
        if(newShare.getShareStrategy() instanceof PlainTextShare)
        {
        paylasim.setText(newShare.getContent());
        }
        else 
        {
            paylasim.setText("<html><font color=\"#0000CF\"><u>"+newShare.getContent()+"</u></font></html>");
        }
        paylasim.setSize(600,50);
        paylasim.setVisible(true);
        kaydir();
        pnlPaylasimlar.add(paylasim);
    }

public void kaydir()
{
    int sayac = 0;
    for(Component c : pnlPaylasimlar.getComponents())
    {
        sayac += 50;
        c.setLocation(c.WIDTH,c.HEIGHT+sayac);
    }
}

private void txtPaylasİnputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_txtPaylasİnputMethodTextChanged
}//GEN-LAST:event_txtPaylasİnputMethodTextChanged

    private void lblProfilimiDuzenleMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblProfilimiDuzenleMouseClicked
        ProfilBilgileriniDuzenle pbd = new ProfilBilgileriniDuzenle();
        pbd.setVisible(true);
        pbd.setLocationRelativeTo(null);
    }//GEN-LAST:event_lblProfilimiDuzenleMouseClicked

    
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(SocialApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(SocialApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(SocialApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(SocialApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new SocialApplication().setVisible(true);
                
 
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnPaylas;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JLabel lblArkadaslar;
    private javax.swing.JLabel lblGruplar;
    private javax.swing.JLabel lblHaberKaynagi;
    private javax.swing.JLabel lblKullaniciAdi;
    private javax.swing.JLabel lblOturumAc;
    private javax.swing.JLabel lblProfilAdi;
    private javax.swing.JLabel lblProfilimiDuzenle;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JPanel pnlPaylasimlar;
    private javax.swing.JTextField txtArama;
    private javax.swing.JTextField txtPaylas;
    // End of variables declaration//GEN-END:variables
}
